// rollup.config.js
import cleanup from 'rollup-plugin-cleanup'

// 配置项可以是一个数组,针对不同的入口做不同的处理
export default [{
    // 核心选项
    input: 'main.js',     // 必须
    plugins: [
        cleanup() //取消注释
    ],
    output: [
      {
        file: 'out/amd/bundle.js',
        format: 'amd',
        amd: {
          id: 'Test'
        }
      },
      {
        file: 'out/cjs/bundle.js',
        format: 'cjs'
      },
      {
        file: 'out/esm/bundle.js',
        format: 'esm'
      },
      {
        file: 'out/iife/bundle.js',
        format: 'iife',
        name: 'Test',
        globals: {
          lodash: 'lodash'
        }
      },
      {
        file: 'out/umd/bundle.js',
        format: 'umd',
        name: 'Test',
        globals: {
          lodash: 'lodash'
        },
        amd: {
          id: 'Test'
        }
      },
      {
        file: 'out/system/bundle.js',
        format: 'system'
      }
    ],
    external: ['lodash']
  },{
      input:'index.js',
      plugins:[
          cleanup()
      ],
      output:[
          {
              file:'out/esm/index-1.js',
              format:'esm'
          },
          {
              file:'out/cjs/index-2.js',
              format:'cjs'
          }
      ]
  }];